local joy__liangzhu = fk.CreateSkill {

  name = "joy__liangzhu",

  tags = {  },

}



joy__liangzhu:addEffect(fk.HpRecover, {
  name = "joy__liangzhu",
  anim_type = "support",
  events = {fk.HpRecover},
  can_trigger = function(self, event, target, player, data)
    return player:hasSkill(joy__liangzhu.name) and target.phase == Player.Play
  end,
  on_cost = function(self, event, target, player, data)
    local all_choices = {"Cancel", "draw1", "joy__liangzhu_draw2::"..target.id, "joy__liangzhu_prey::"..target.id}
    local choices = table.simpleClone(all_choices)
    if target:getEquipment(Card.SubtypeWeapon) == nil then
      table.removeOne(choices, choices[4])
    end
    local choice = player.room:askForChoice(player, choices, joy__liangzhu.name, "#joy__liangzhu-choice::"..target.id, false, all_choices)
    if choice ~= "Cancel" then
      event:setCostData(self, choice)
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    if event:getCostData(self) == "draw1" then
      player:drawCards(1, joy__liangzhu.name)
    elseif event:getCostData(self)[15] == "d" then
      room:doIndicate(player.id, {target.id})
      target:drawCards(2, joy__liangzhu.name)
    else
      room:doIndicate(player.id, {target.id})
      room:obtainCard(player, target:getEquipment(Card.SubtypeWeapon), true, fk.ReasonPrey)
    end
  end,
})

return joy__liangzhu